package com.qq.financeSystem.service.impl;

import com.qq.financeSystem.mapper.OffsetMapper;
import com.qq.financeSystem.model.Offset;
import com.qq.financeSystem.model.YearAndMonth;
import com.qq.financeSystem.service.OffsetService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class OffsetServiceImpl implements OffsetService {

    @Autowired
    OffsetMapper offsetMapper;

    @Override
    public List<Offset> queryAllOffset(String ident) {
        return offsetMapper.selectAllOffset(ident);
    }

    @Override
    public int addOffset(Offset offset) {
        return offsetMapper.insertOffset(offset);
    }

    @Override
    public List<Offset> queryOffsetByKey(YearAndMonth key) {
        return offsetMapper.selectOffsetByKey(key);
    }

    @Override
    public List<Offset> queryAllOffsetById(String employeeId) {
        return offsetMapper.selectAllOffsetById(employeeId);
    }

    @Override
    public List<Offset> queryLastOffsetById(YearAndMonth key) {
        return offsetMapper.selectLastOffsetById(key);
    }

    @Override
    public List<Offset> selectLastOneById(String empId) {
        return offsetMapper.selectLastOneById(empId);
    }

    @Override
    public String queryOneByIdAndName(String empId, String empName) {
        return offsetMapper.selectOneByIdAndName(empId, empName);
    }

    @Override
    public int delOneById(String offsetId) {
        return offsetMapper.deleteOneById(offsetId);
    }
}
